package com.xdwanj.dao;

import com.xdwanj.pojo.ShoppingCart;
import com.xdwanj.util.PageBean;

import java.util.List;

public interface ShoppingCartDao {
    /**
     * 通过用户查询购物车列表
     *
     * @param Name
     * @param currentPageNo
     * @param pageSize
     * @return
     */
    PageBean<ShoppingCart> findShoppingCartByUser(String Name, int userId, int currentPageNo, int pageSize) throws Exception;

    /**
     * 通过Id找购物车
     *
     * @param id
     * @return 购物车对象
     * @throws Exception
     */
    ShoppingCart findById(int id) throws Exception;

    /**
     * 通过用户Id查购物车
     *
     * @param uid
     * @return
     * @throws Exception
     */
    List<ShoppingCart> findByUserId(int uid) throws Exception;

    /**
     * 添加购物车
     *
     * @param uid
     * @param coid
     * @param count
     * @return
     * @throws Exception
     */
    void addShoppingCart(int uid, int coid, int count) throws Exception;

    /**
     * 根据uid comId 更新购物车
     *
     * @param comId
     * @param uid
     * @param num
     * @return
     * @throws Exception
     */
    int updateShoppingCart(int comId, int uid, int num) throws Exception;

    /**
     * 删除购物车
     *
     * @param id
     * @return
     * @throws Exception
     */
    void deleteShoppingCart(int id, int uid) throws Exception;

}
